/**
 ****************************************************************************
 * Copyright (C) Marcelo F. Ochoa. All rights reserved.                      *
 * ------------------------------------------------------------------------- *
 * This software is published under the terms of the Apache Software License *
 * version 1.1, a copy of which has been included  with this distribution in *
 * the LICENSE file.                                                         *
 */

package org.apache.cocoon.util;

import sun.misc.BASE64Encoder;

/**
 * This class is a helper class for converting user/password
 * to HTTP header B64 encoding
 * @author <a href="mailto:mochoa@ieee.org">Marcelo F. Ochoa</a>
 * @version 1.0
 * @see sun.misc.BASE64Encoder
 *   for the encoding library
 */
public class B64Encoder {
  public static void main(String[] args) {
     BASE64Encoder B64 = new BASE64Encoder();
     if (args.length != 2) {
            System.out.println(
                "Usage: java org.apache.cocoon.util.B64Encoder cache-adm-user cache-adm-pass");
            System.exit(-1);
     }
     String buffer = args[0]+":"+args[1];
     System.out.println("B64.string="+B64.encodeBuffer(buffer.getBytes()));
  }
} 